//
//  InfoOverviewView.m
//  cocoapodText
//
//  Created by apple on 16/9/7.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ShiPei.h"
#import "InfoOverviewView.h"
#import <Foundation/Foundation.h>

@interface InfoOverviewView()<FSSwitchCommonMenuItemDelegate,GYMapMenuDelegate,BMKMapViewDelegate,BMKGeoCodeSearchDelegate,BMKMapViewDelegate>
@end

@implementation InfoOverviewView

/**
 *  初始化视图属性
 *
 *  @param frame 视图frame
 *
 *  @return self
 */
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //定制View
        self.backgroundColor = [UIColor clearColor];
        self.userInteractionEnabled = YES; //设置为NO后，不再响应touch方法
        self.multipleTouchEnabled = YES;
        //控制子视图不能超出父视图的范围
        self.clipsToBounds = YES;
        //添加子视图
        [self subView];
    }
    return self;
}

//子视图懒加载
-(void)subView{
    //内容栏
    _AllBackScrollView=[[UIScrollView alloc]initWithFrame:CGRectMake([ShiPei CGFloatMakeScale:17.5], 0, [ShiPei CGFloatMakeScale:TabChildContentW+35], kScreenH-CommonBarH-kStatusH-[ShiPei CGFloatMakeScale:FSCommonBottomH])];
    [self addSubview:_AllBackScrollView];
    _AllBackScrollView.delaysContentTouches = NO;
    [_AllBackScrollView setContentSize:CGSizeMake([ShiPei CGFloatMakeScale:TabChildContentW], 890)];
    [_AllBackScrollView setShowsVerticalScrollIndicator:NO];
    [_AllBackScrollView setDelegate:self];
    
    // Set the callback（Once you enter the refresh status，then call the action of target，that is call [self loadNewData]）
    self.AllBackScrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
    
    // Enter the refresh status immediately
    [self.AllBackScrollView.mj_header beginRefreshing];
    
    [self initSurveyInfoView];
    [self initEnergySavingCard];
    [self initCurrentEnergy];
    [self initGYMapView];
    [self initCompletionRateWithEnergy];
    [self initShareAnalysisWithEnergy];
}

-(void)loadNewData{
    [self setData];
    // 模拟1秒后刷新UI
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        // 拿到当前的下拉刷新控件，结束刷新状态
        [self.AllBackScrollView.mj_header endRefreshing];
    });
}

-(void)initSurveyInfoView{
    ///1.概览
    UIView *surveyContentView=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :12.5 :TabChildContentW :200]];
    [_AllBackScrollView addSubview:surveyContentView];
    [surveyContentView setUserInteractionEnabled:YES];
    
    OverviewCardView *overviewCardView1=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :0:270 :95]];
    [surveyContentView addSubview:overviewCardView1];
    self.overviewCardView1=overviewCardView1;
    [overviewCardView1 setCardBGImage:FUIColorFromRGB(0x27a9e4)];
    [overviewCardView1 setCardTypeImage:@"info_overview_card_01.png"];
    [overviewCardView1 setCardTypeLabel:@"区县数量"];
    [overviewCardView1 setCardNumberLabel:@"0"];
    [overviewCardView1 setCardUnitLabel:@"个"];
    
    OverviewCardView *overviewCardView2=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:280 :0:270 :95]];
    [surveyContentView addSubview:overviewCardView2];
    self.overviewCardView2=overviewCardView2;
    [overviewCardView2 setCardBGImage:FUIColorFromRGB(0x28b779)];
    [overviewCardView2 setCardTypeImage:@"info_overview_card_02.png"];
    [overviewCardView2 setCardTypeLabel:@"用能单位数量"];
    [overviewCardView2 setCardNumberLabel:@"0"];
    [overviewCardView2 setCardUnitLabel:@"家"];
    
    OverviewCardView *overviewCardView3=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:560 :0:270 :95]];
    [surveyContentView addSubview:overviewCardView3];
    self.overviewCardView3=overviewCardView3;
    [overviewCardView3 setCardBGImage:FUIColorFromRGB(0xffb848)];
    [overviewCardView3 setCardTypeImage:@"info_overview_card_03.png"];
    [overviewCardView3 setCardTypeLabel:@"产能单位数量"];
    [overviewCardView3 setCardNumberLabel:@"0"];
    [overviewCardView3 setCardUnitLabel:@"家"];
    
    OverviewCardView *overviewCardView4=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :105:270 :95]];
    [surveyContentView addSubview:overviewCardView4];
    self.overviewCardView4=overviewCardView4;
    [overviewCardView4 setCardBGImage:FUIColorFromRGB(0x59cc9a)];
    [overviewCardView4 setCardTypeImage:@"info_overview_card_04.png"];
    [overviewCardView4 setCardTypeLabel:@"昨日能耗"];
    [overviewCardView4 setCardNumberLabel:@"0"];
    [overviewCardView4 setCardUnitLabel:@"tce"];
    
    OverviewCardView *overviewCardView5=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:280 :105:270 :95]];
    [surveyContentView addSubview:overviewCardView5];
    self.overviewCardView5=overviewCardView5;
    [overviewCardView5 setCardBGImage:FUIColorFromRGB(0x58afd7)];
    [overviewCardView5 setCardTypeImage:@"info_overview_card_05.png"];
    [overviewCardView5 setCardTypeLabel:@"本月能耗"];
    [overviewCardView5 setCardNumberLabel:@"0"];
    [overviewCardView5 setCardUnitLabel:@"tce"];
    
    OverviewCardView *overviewCardView6=[[OverviewCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:560 :105:270 :95]];
    [surveyContentView addSubview:overviewCardView6];
    self.overviewCardView6=overviewCardView6;
    [overviewCardView6 setCardBGImage:FUIColorFromRGB(0xff7b5c)];
    [overviewCardView6 setCardTypeImage:@"info_overview_card_06.png"];
    [overviewCardView6 setCardTypeLabel:@"全年能耗"];
    [overviewCardView6 setCardNumberLabel:@"0"];
    [overviewCardView6 setCardUnitLabel:@"tce"];
}

-(void)initEnergySavingCard{
    //节能效果展示
    UIView *EnergySavingEffectDisplay=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :222.5 :330 :200]];
    [_AllBackScrollView addSubview:EnergySavingEffectDisplay];
    [EnergySavingEffectDisplay setUserInteractionEnabled:YES];
    [EnergySavingEffectDisplay setBackgroundColor:[UIColor whiteColor]];
    
    UIImageView *ModuleImage=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:15 :20 :15 :15]];
    [EnergySavingEffectDisplay addSubview:ModuleImage];
    [ModuleImage setImage:[UIImage imageNamed:@"fs_main_id_image.png"]];
    
    UILabel *ModuleLabel=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:40 :15 :120 :20]];
    [EnergySavingEffectDisplay addSubview:ModuleLabel];
    [ModuleLabel setText:@"本年节能效果展示"];
    [ModuleLabel setTextColor:FUIColorFromRGB(0x333333)];
    [ModuleLabel setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:28]]];
    
    EnergySavingCardView *energySavingCardView1=[[EnergySavingCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:20 :50:150 :70]];
    [EnergySavingEffectDisplay addSubview:energySavingCardView1];
    self.energySavingCardView1=energySavingCardView1;
    [energySavingCardView1 setCardTypeImage:@"energy_card_01.png"];
    [energySavingCardView1 setLabelColor:FUIColorFromRGB(0xff7b5c)];
    [energySavingCardView1 setCardTypeLabel:@"节能项目数量"];
    [energySavingCardView1 setCardNumberLabel:@"20"];
    [energySavingCardView1 setCardUnitLabel:@"个"];
    
    EnergySavingCardView *energySavingCardView2=[[EnergySavingCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:170 :50:150 :70]];
    [EnergySavingEffectDisplay addSubview:energySavingCardView2];
    self.energySavingCardView2=energySavingCardView2;
    [energySavingCardView2 setCardTypeImage:@"energy_card_02.png"];
    [energySavingCardView2 setLabelColor:FUIColorFromRGB(0xff3a00)];
    [energySavingCardView2 setCardTypeLabel:@"节能量"];
    [energySavingCardView2 setCardNumberLabel:@"20"];
    [energySavingCardView2 setCardUnitLabel:@"tce"];
    
    EnergySavingCardView *energySavingCardView3=[[EnergySavingCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:20 :120:150 :70]];
    [EnergySavingEffectDisplay addSubview:energySavingCardView3];
    self.energySavingCardView3=energySavingCardView3;
    [energySavingCardView3 setCardTypeImage:@"energy_card_03.png"];
    [energySavingCardView3 setLabelColor:FUIColorFromRGB(0x28b779)];
    [energySavingCardView3 setCardTypeLabel:@"减排量"];
    [energySavingCardView3 setCardNumberLabel:@"20"];
    [energySavingCardView3 setCardUnitLabel:@"t"];
    
    EnergySavingCardView *energySavingCardView4=[[EnergySavingCardView alloc]initWithFrame:[ShiPei CGRectMakeScale:170 :120:150 :70]];
    [EnergySavingEffectDisplay addSubview:energySavingCardView4];
    self.energySavingCardView4=energySavingCardView4;
    [energySavingCardView4 setCardTypeImage:@"energy_card_04.png"];
    [energySavingCardView4 setLabelColor:FUIColorFromRGB(0x58afd7)];
    [energySavingCardView4 setCardTypeLabel:@"月度环保增幅"];
    [energySavingCardView4 setCardNumberLabel:@"20"];
    [energySavingCardView4 setCardUnitLabel:@"％"];
}

-(void)initCurrentEnergy{
    //当前用能情况
    UIView *CurrentEnergySituation=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :432.5 :330 :200]];
    [_AllBackScrollView addSubview:CurrentEnergySituation];
    [CurrentEnergySituation setUserInteractionEnabled:YES];
    [CurrentEnergySituation setBackgroundColor:[UIColor whiteColor]];
    
    UIImageView *ModuleImage=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:15 :20 :15 :15]];
    [CurrentEnergySituation addSubview:ModuleImage];
    [ModuleImage setImage:[UIImage imageNamed:@"fs_main_id_image.png"]];
    
    UILabel *ModuleLabel=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:40 :15 :120 :20]];
    [CurrentEnergySituation addSubview:ModuleLabel];
    [ModuleLabel setTextColor:FUIColorFromRGB(0x333333)];
    [ModuleLabel setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:28]]];
    [ModuleLabel setText:@"当前用能情况"];
    
    FSSwitchMenuCommon *ModuleMenu=[[FSSwitchMenuCommon alloc]init];
    [CurrentEnergySituation addSubview:ModuleMenu];
    self.ModuleMenu1=ModuleMenu;
    [self.ModuleMenu1 setMenuDelegate:self];
    [ModuleMenu setTabItem1Text:@"冷"];
    [ModuleMenu setTabItem2Text:@"气"];
    [ModuleMenu setTabItem3Text:@"水"];
    [ModuleMenu setTabItem4Text:@"电"];
    [ModuleMenu setFrame:[ShiPei CGRectMakeScale:160 :15 :160 :FSCommonMenuH]];
    
    YearOnYearAndLinkRelativeView *yearOnYearAndLinkRelativeView1=[[YearOnYearAndLinkRelativeView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :45 :330 :50]];
    [CurrentEnergySituation addSubview:yearOnYearAndLinkRelativeView1];
    [yearOnYearAndLinkRelativeView1 setCardType:@"昨日累计"];
    [yearOnYearAndLinkRelativeView1 setNumber:@"0"];
    [yearOnYearAndLinkRelativeView1 setUnit:@"kWh"];
    [yearOnYearAndLinkRelativeView1 setYearOnYear:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView1 setLinkRelative:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView1 setHiddenFenGeXian:NO];
    self.yearOnYearAndLinkRelativeView1=yearOnYearAndLinkRelativeView1;
    
    YearOnYearAndLinkRelativeView *yearOnYearAndLinkRelativeView2=[[YearOnYearAndLinkRelativeView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :95 :330 :50]];
    [CurrentEnergySituation addSubview:yearOnYearAndLinkRelativeView2];
    [yearOnYearAndLinkRelativeView2 setCardType:@"本月累计"];
    [yearOnYearAndLinkRelativeView2 setNumber:@"0"];
    [yearOnYearAndLinkRelativeView2 setUnit:@"kWh"];
    [yearOnYearAndLinkRelativeView2 setYearOnYear:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView2 setLinkRelative:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView2 setHiddenFenGeXian:NO];
    self.yearOnYearAndLinkRelativeView2=yearOnYearAndLinkRelativeView2;
    
    YearOnYearAndLinkRelativeView *yearOnYearAndLinkRelativeView3=[[YearOnYearAndLinkRelativeView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :145 :330 :50]];
    [CurrentEnergySituation addSubview:yearOnYearAndLinkRelativeView3];
    [yearOnYearAndLinkRelativeView3 setCardType:@"本年累计"];
    [yearOnYearAndLinkRelativeView3 setNumber:@"0"];
    [yearOnYearAndLinkRelativeView3 setUnit:@"kWh"];
    [yearOnYearAndLinkRelativeView3 setYearOnYear:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView3 setLinkRelative:@"0" status:@"1"];
    [yearOnYearAndLinkRelativeView3 setHiddenFenGeXian:YES];
    self.yearOnYearAndLinkRelativeView3=yearOnYearAndLinkRelativeView3;
}

-(void)initGYMapView{
    //贵阳地图
    UIView *GYMapBackView=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:340 :222.5 :490 :410]];
    [_AllBackScrollView addSubview:GYMapBackView];
    [GYMapBackView setUserInteractionEnabled:YES];
    [GYMapBackView setBackgroundColor:[UIColor whiteColor]];
    [GYMapBackView.layer setBorderWidth:1];
    [GYMapBackView.layer setBorderColor:[FUIColorFromRGB(0xbbbbbb) CGColor]];
    //加载百度地图
    BMKMapView *mapView = [[BMKMapView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :0 :490 :410]];
    [GYMapBackView addSubview:mapView];
    [mapView setUserInteractionEnabled:YES];
    [mapView setZoomLevel:15];
    [mapView setMapType:BMKMapTypeSatellite];
    self.mapView=mapView;
    [self.mapView setDelegate:self];
    
    //初始化检索对象
    _searcher =[[BMKGeoCodeSearch alloc]init];
    _searcher.delegate = self;
    //调用地图转移到贵阳市
    [self mapLoc];
    OverViewMapMenu *mapMenu=[[OverViewMapMenu alloc]initWithFrame:[ShiPei CGRectMakeScale:345 :0 :145 :410]];
    [GYMapBackView addSubview:mapMenu];
    [mapMenu setUserInteractionEnabled:YES];
    [mapMenu setDelegate:self];
    self.mapMenu=mapMenu;
    
    UISwitch *changeHuaDongObj=[[UISwitch alloc]initWithFrame:[ShiPei CGRectMakeScale:10 :10 :100 :15]];
    [changeHuaDongObj setOn:NO];
    [changeHuaDongObj addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
    // 显示的颜色
    changeHuaDongObj.onTintColor = FUIColorFromRGB(0x58afd7);
    // 控件大小，不能设置frame，只能用缩放比例
    changeHuaDongObj.transform = CGAffineTransformMakeScale(0.75, 0.75);
    self.changeHuaDongObj=changeHuaDongObj;
    [GYMapBackView addSubview:self.changeHuaDongObj];
    
    UIImageView *imageline=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:340 :222.5 :490 :3]];
    [_AllBackScrollView addSubview:imageline];
    [imageline setBackgroundColor:FUIColorFromRGB(0x1b75cc)];
}


-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    //记录偏移量
    [CommonTool updateValueWithKey:@"contentOffsetY" value:[NSString stringWithFormat:@"%f",scrollView.contentOffset.y]];
}

-(void)initCompletionRateWithEnergy{
    UIView *CompletionRateWithEnergy=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :642.5 :490 :240]];
    [_AllBackScrollView addSubview:CompletionRateWithEnergy];
    [CompletionRateWithEnergy setUserInteractionEnabled:YES];
    [CompletionRateWithEnergy setBackgroundColor:[UIColor whiteColor]];
    
    UIImageView *ModuleImage=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:15 :20 :15 :15]];
    [CompletionRateWithEnergy addSubview:ModuleImage];
    [ModuleImage setImage:[UIImage imageNamed:@"fs_main_id_image.png"]];
    
    UILabel *ModuleLabel=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:40 :15 :120 :20]];
    [CompletionRateWithEnergy addSubview:ModuleLabel];
    [ModuleLabel setTextColor:FUIColorFromRGB(0x333333)];
    [ModuleLabel setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:28]]];
    [ModuleLabel setText:@"用能定额完成率"];
    
    FSSwitchMenuCommon *ModuleMenu=[[FSSwitchMenuCommon alloc]init];
    [CompletionRateWithEnergy addSubview:ModuleMenu];
    self.ModuleMenu2=ModuleMenu;
    [self.ModuleMenu2 setMenuDelegate:self];
    [ModuleMenu setTabItem1Text:@"冷"];
    [ModuleMenu setTabItem2Text:@"气"];
    [ModuleMenu setTabItem3Text:@"水"];
    [ModuleMenu setTabItem4Text:@"电"];
    [ModuleMenu setFrame:[ShiPei CGRectMakeScale:320 :15 :160 :FSCommonMenuH]];
    
    //颜色标识
    UIImageView *image01=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:182 :41 :8 :8]];
    [image01 setBackgroundColor:FUIColorFromRGB(0xb7a1e0)];
    [CompletionRateWithEnergy addSubview:image01];
    UIImageView *image02=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:252 :41 :8 :8]];
    [image02 setBackgroundColor:FUIColorFromRGB(0x55b0f1)];
    [CompletionRateWithEnergy addSubview:image02];
    UILabel *label1=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:195 :40 :50 :10]];
    [label1 setText:@"实际完成"];
    [label1 setTextColor:FUIColorFromRGB(0x666666)];
    [label1 setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:20]]];
    [CompletionRateWithEnergy addSubview:label1];
    UILabel *label2=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:270 :40 :50 :10]];
    [label2 setText:@"定额指标"];
    [label2 setTextColor:FUIColorFromRGB(0x666666)];
    [label2 setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:20]]];
    [CompletionRateWithEnergy addSubview:label2];
    
    UIScrollView *CompletionRateWithEnergyScroll=[[UIScrollView alloc]initWithFrame:[ShiPei CGRectMakeScale:10 :50 :470 :180]];
    [CompletionRateWithEnergy addSubview:CompletionRateWithEnergyScroll];
    [CompletionRateWithEnergyScroll setContentSize:[ShiPei CGSizeMakeScale:800 :180]];
    [CompletionRateWithEnergyScroll setShowsVerticalScrollIndicator:NO];
    [CompletionRateWithEnergyScroll setShowsHorizontalScrollIndicator:NO];
    
    _CompletionRateBarChart=[[BarChartView alloc] initWithFrame:[ShiPei CGRectMakeScale:0 :0 :800 :180]];
    _CompletionRateBarChart.backgroundColor = [UIColor whiteColor];
    [CompletionRateWithEnergyScroll addSubview:_CompletionRateBarChart];
    [self initBarChartStyleAndData];
}

-(void)initShareAnalysisWithEnergy{
    UIView *ShareAnalysisWithEnergy=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:500 :642.5 :330 :240]];
    [_AllBackScrollView addSubview:ShareAnalysisWithEnergy];
    [ShareAnalysisWithEnergy setUserInteractionEnabled:YES];
    [ShareAnalysisWithEnergy setBackgroundColor:[UIColor whiteColor]];
    
    UIImageView *ModuleImage=[[UIImageView alloc]initWithFrame:[ShiPei CGRectMakeScale:15 :20 :15 :15]];
    [ShareAnalysisWithEnergy addSubview:ModuleImage];
    [ModuleImage setImage:[UIImage imageNamed:@"fs_main_id_image.png"]];
    
    UILabel *ModuleLabel=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:40 :15 :120 :20]];
    [ShareAnalysisWithEnergy addSubview:ModuleLabel];
    [ModuleLabel setTextColor:FUIColorFromRGB(0x333333)];
    [ModuleLabel setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:28]]];
    [ModuleLabel setText:@"用能分项分析"];
    
    FSSwitchMenuCommon *ModuleMenu=[[FSSwitchMenuCommon alloc]init];
    [ShareAnalysisWithEnergy addSubview:ModuleMenu];
    self.ModuleMenu3=ModuleMenu;
    [self.ModuleMenu3 setMenuDelegate:self];
    [ModuleMenu setTabItem1Text:@"冷"];
    [ModuleMenu setTabItem2Text:@"气"];
    [ModuleMenu setTabItem3Text:@"水"];
    [ModuleMenu setTabItem4Text:@"电"];
    [ModuleMenu setFrame:[ShiPei CGRectMakeScale:160 :15 :160 :FSCommonMenuH]];
    
    //饼图
    PieChartView *EnergySharePieChart=[[PieChartView alloc] initWithFrame:[ShiPei CGRectMakeScale:105 :70 :160 :160]];
    EnergySharePieChart.backgroundColor = [UIColor whiteColor];
    [ShareAnalysisWithEnergy addSubview:EnergySharePieChart];
    self.EnergySharePieChart=EnergySharePieChart;
    [self initPieChartStyle:EnergySharePieChart];
    
    UIView *ShareAnalysisWithEnergyPie=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:1 :70 :140 :110]];
    [ShareAnalysisWithEnergy addSubview:ShareAnalysisWithEnergyPie];
    [ShareAnalysisWithEnergyPie setUserInteractionEnabled:YES];
    [ShareAnalysisWithEnergyPie setBackgroundColor:[UIColor clearColor]];
    
    self.ShareAnalysisWithEnergyPie=ShareAnalysisWithEnergyPie;
}

-(void)refresh{
    [self.changeHuaDongObj setOn:NO];
    //隐藏蒙罩
    [_maskView setHidden:YES];
    [_AllBackScrollView setScrollEnabled:YES];
}

-(void)switchAction:(id)sender{
    UISwitch *switchButton = (UISwitch*)sender;
    BOOL isButtonOn = [switchButton isOn];
    if (isButtonOn) {
        [_maskView removeFromSuperview];
        //添加全屏的黑色半透明蒙版
        UIView *maskView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [ShiPei CGFloatMakeScale:TabChildContentW+35], kScreenH-CommonBarH-kStatusH-[ShiPei CGFloatMakeScale:FSCommonBottomH])];
        maskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
        [maskView setUserInteractionEnabled:NO];
        //从蒙版中扣出扫描框那一块
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRect:self.bounds];
        CGFloat contentOffsetY=[[CommonTool getValueFromKey:@"contentOffsetY" defaultValue:@"0"] floatValue];
        [maskPath appendPath:[[UIBezierPath bezierPathWithRoundedRect:[ShiPei CGRectMakeScale:347.5 :212.5-contentOffsetY :510 :430] cornerRadius:1] bezierPathByReversingPath]];
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
        maskLayer.path = maskPath.CGPath;
        maskView.layer.mask = maskLayer;
        _maskView=maskView;
        [self addSubview:_maskView];
        [_maskView setHidden:NO];
        [_AllBackScrollView setScrollEnabled:NO];
    }else {
        //隐藏蒙罩
        [_maskView setHidden:YES];
        [_AllBackScrollView setScrollEnabled:YES];
    }
}

-(void)switchMenuCommonByTabItem:(FSSwitchMenuCommon *)menu menuId:(int)tag destinationTab:(int)end{
    if (menu==self.ModuleMenu1) {
        if ([self.delegate respondsToSelector:@selector(onSwitchMenuByTabItem:MenuId:destinationTab: )]) {
            [self.delegate onSwitchMenuByTabItem:self MenuId:1 destinationTab:end];
        }
    }else if (menu==self.ModuleMenu2) {
        if ([self.delegate respondsToSelector:@selector(onSwitchMenuByTabItem:MenuId:destinationTab: )]) {
            [self.delegate onSwitchMenuByTabItem:self MenuId:2 destinationTab:end];
        }
    }else if (menu==self.ModuleMenu3) {
        if ([self.delegate respondsToSelector:@selector(onSwitchMenuByTabItem:MenuId:destinationTab: )]) {
            [self.delegate onSwitchMenuByTabItem:self MenuId:3 destinationTab:end];
        }
    }
}

-(void)mapLoc{
    BMKGeoCodeSearchOption *geoCodeSearchOption = [[BMKGeoCodeSearchOption alloc]init];
    geoCodeSearchOption.city= @"贵阳市";
    geoCodeSearchOption.address = @"贵阳市";
    BOOL flag = [_searcher geoCode:geoCodeSearchOption];
    if(flag){
        NSLog(@"geo检索发送成功");
    }else{
        NSLog(@"geo检索发送失败");
    }
}

-(void)onClickLocMenu:(OverViewMapMenu *)mapMenu{
    //调用地图转移到贵阳市
    NSString *temText=mapMenu.ItemAreaLabel.text;
    for (int i=0; i<[self.coorArray count]; i++) {
        //组织代码列表解析（地图）
        NSDictionary *mapMarker=[self.coorArray objectAtIndex:i];
        NSString *orgName=[CommonTool getStringFromNSDictionary:mapMarker key:@"orgName" defaultValue:@""];
        if ([orgName isEqualToString:temText]) {
            NSString *xcoordinate=[CommonTool getStringFromNSDictionary:mapMarker key:@"xcoordinate" defaultValue:@"0"];
            NSString *ycoordinate=[CommonTool getStringFromNSDictionary:mapMarker key:@"ycoordinate" defaultValue:@"0"];
            //添加标注坐标
            CLLocationCoordinate2D temCoor=CLLocationCoordinate2DMake( [ycoordinate doubleValue],[xcoordinate doubleValue]);
            _mapView.centerCoordinate=temCoor;
            //BMKCoordinateSpan span={0.5, 0.5};
            //_mapView.limitMapRegion = {temCoor, span};////限制地图显示范围
            _mapView.rotateEnabled = NO;//禁用旋转手势
        }
    }
}

-(void)onClickMapMenuWithTab:(int)tab Menu:(OverViewMapMenu *)mapMenu{
}

-(void)setData{
    if([_delegate respondsToSelector:@selector(onSetData:)]){
        [_delegate onSetData:self];
    }
}

-(void)refreshOrgNoMapData:(NSDictionary *)data{
    
    //qymessage：企业数量  daynhmessage：昨日能耗取val  day01message:昨日用电day02message：昨日用水 day03message：昨日用气  day05message：昨日用冷
    NSString *qymessage=[CommonTool getStringFromNSDictionary:data key:@"qymessage" defaultValue:@"0"];
    NSString *daynhmessage=[CommonTool getStringFromNSDictionary:[data objectForKey:@"daynhmessage"] key:@"val" defaultValue:@"0"];
    NSString *day01message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day01message"] key:@"val" defaultValue:@"0"];
    NSString *day02message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day02message"] key:@"val" defaultValue:@"0"];
    NSString *day03message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day03message"] key:@"val" defaultValue:@"0"];
    NSString *day05message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day05message"] key:@"val" defaultValue:@"0"];
    
    qymessage=[CommonTool keepDecimal:qymessage];
    daynhmessage=[CommonTool keepDecimal:daynhmessage];
    day01message=[CommonTool keepDecimal:day01message];
    day02message=[CommonTool keepDecimal:day02message];
    day03message=[CommonTool keepDecimal:day03message];
    day05message=[CommonTool keepDecimal:day05message];
    
    qymessage=[qymessage stringByAppendingString:@"家"];
    daynhmessage=[daynhmessage stringByAppendingString:@"tce"];
    day01message=[day01message stringByAppendingString:@"kWh"];
    day02message=[day02message stringByAppendingString:@"m³"];
    day03message=[day03message stringByAppendingString:@"m³"];
    day05message=[day05message stringByAppendingString:@"GJ"];
    
    [self.mapMenu.ItemLabel01 setText:qymessage];
    [self.mapMenu.ItemLabel02 setText:daynhmessage];
    [self.mapMenu.ItemLabel03 setText:day01message];
    [self.mapMenu.ItemLabel04 setText:day02message];
    [self.mapMenu.ItemLabel05 setText:day03message];
    [self.mapMenu.ItemLabel06 setText:day05message];
}

-(void)refreshMapData:(NSMutableArray *)array Info:(NSDictionary *)data{
    [_mapView removeAnnotations:_mapView.annotations];
    self.coorArray=[NSMutableArray array];
    for (int i=0; i<[array count]; i++) {
        [self.coorArray addObject:[array objectAtIndex:i]];
    }
    //qymessage：企业数量  daynhmessage：昨日能耗取val  day01message:昨日用电day02message：昨日用水 day03message：昨日用气  day05message：昨日用冷
    NSString *qymessage=[CommonTool getStringFromNSDictionary:data key:@"qymessage" defaultValue:@"0"];
    NSString *daynhmessage=[CommonTool getStringFromNSDictionary:[data objectForKey:@"daynhmessage"] key:@"val" defaultValue:@"0"];
    NSString *day01message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day01message"] key:@"val" defaultValue:@"0"];
    NSString *day02message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day02message"] key:@"val" defaultValue:@"0"];
    NSString *day03message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day03message"] key:@"val" defaultValue:@"0"];
    NSString *day05message=[CommonTool getStringFromNSDictionary:[data objectForKey:@"day05message"] key:@"val" defaultValue:@"0"];
    
    qymessage=[CommonTool keepDecimal:qymessage];
    daynhmessage=[CommonTool keepDecimal:daynhmessage];
    day01message=[CommonTool keepDecimal:day01message];
    day02message=[CommonTool keepDecimal:day02message];
    day03message=[CommonTool keepDecimal:day03message];
    day05message=[CommonTool keepDecimal:day05message];
    
    qymessage=[qymessage stringByAppendingString:@"家"];
    daynhmessage=[daynhmessage stringByAppendingString:@"tce"];
    day01message=[day01message stringByAppendingString:@"kWh"];
    day02message=[day02message stringByAppendingString:@"m³"];
    day03message=[day03message stringByAppendingString:@"m³"];
    day05message=[day05message stringByAppendingString:@"GJ"];
    
    NSMutableArray *annotations = [NSMutableArray array];
    for (int i=0; i<[array count]; i++) {
        //组织代码列表解析（地图）
        NSDictionary *mapMarker=[array objectAtIndex:i];
        NSString *orgName=[CommonTool getStringFromNSDictionary:mapMarker key:@"orgName" defaultValue:@""];
        NSString *orgNo=[CommonTool getStringFromNSDictionary:mapMarker key:@"orgNo" defaultValue:@""];
        NSString *xcoordinate=[CommonTool getStringFromNSDictionary:mapMarker key:@"xcoordinate" defaultValue:@"0"];
        NSString *ycoordinate=[CommonTool getStringFromNSDictionary:mapMarker key:@"ycoordinate" defaultValue:@"0"];
        //添加标注坐标
        CLLocationCoordinate2D temCoor=CLLocationCoordinate2DMake( [ycoordinate doubleValue],[xcoordinate doubleValue]);
        if (i==0) {
            _mapView.centerCoordinate=temCoor;
            //BMKCoordinateSpan span={0.5, 0.5};
            //_mapView.limitMapRegion = {temCoor, span};////限制地图显示范围
            _mapView.rotateEnabled = NO;//禁用旋转手势
            [self.mapMenu.ItemAreaLabel setText:orgName];
        }
        BMKPointAnnotation *annotation_user = [[BMKPointAnnotation alloc] init];
        annotation_user.coordinate = temCoor;
        //在此处理正常结果
        annotation_user.title = orgNo;
        annotation_user.subtitle = orgName;
        [annotations addObject:annotation_user];
    }
    [self.mapMenu.ItemLabel01 setText:qymessage];
    [self.mapMenu.ItemLabel02 setText:daynhmessage];
    [self.mapMenu.ItemLabel03 setText:day01message];
    [self.mapMenu.ItemLabel04 setText:day02message];
    [self.mapMenu.ItemLabel05 setText:day03message];
    [self.mapMenu.ItemLabel06 setText:day05message];
    [_mapView addAnnotations:annotations];
}

-(void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate{
}

-(void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus *)status{
}


#pragma mark - BMKMapViewDelegate

/**
 *根据anntation生成对应的View
 *@param mapView 地图View
 *@param annotation 指定的标注
 *@return 生成的标注View
 */
- (BMKAnnotationView *)mapView:(BMKMapView *)view viewForAnnotation:(id <BMKAnnotation>)annotation{
    // 检查是否有重用的缓存
    NSString *AnnotationViewID = @"AnimatedAnnotation";
    MyLabelImageAnnotationView *annotationView = nil;
    if (annotationView == nil) {
        annotationView = [[MyLabelImageAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID];
    }
    annotationView.annotation = annotation;
    // 单击弹出泡泡，弹出泡泡前提annotation必须实现title属性
    annotationView.canShowCallout = NO;
    // 设置是否可以拖拽
    annotationView.draggable = NO;
    annotationView.label=annotation.subtitle;
    //点击事件
    [annotationView.annotationImageView setUserInteractionEnabled:YES];
    UITapGestureRecognizer *clickImage = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImage:)];
    [annotationView.annotationImageView setTag:[annotation.title integerValue]];
    [annotationView.annotationImageView addGestureRecognizer:clickImage];
    return annotationView;
}

-(void)clickImage:(UITapGestureRecognizer *)Recognizer{
    MyLabelImageAnnotationView *annotationView=(MyLabelImageAnnotationView *)Recognizer.view;
    NSInteger orgNo=annotationView.tag;
    NSString *orgName;
    NSString *orgNoStr=[NSString stringWithFormat:@"%ld",(long)orgNo];
    for (int i=0; i<[self.coorArray count]; i++) {
        //组织代码列表解析（地图）
        NSDictionary *mapMarker=[self.coorArray objectAtIndex:i];
        NSString *orgNo=[CommonTool getStringFromNSDictionary:mapMarker key:@"orgNo" defaultValue:@""];
        if ([orgNo isEqualToString:orgNoStr]) {
            orgName=[CommonTool getStringFromNSDictionary:mapMarker key:@"orgName" defaultValue:@""];
        }
    }
    if ([self.delegate respondsToSelector:@selector(onSwitchMapORG:orgId:orgName:)]) {
        [self.delegate onSwitchMapORG:self orgId:[NSString stringWithFormat:@"%ld",(long)orgNo] orgName:orgName];
    }
}

//设置饼图数据
-(void)pieChartData{
    [_EnergySharePieChart setDelegate:self];
    [_EnergySharePieChart setData:[self setPieData]];
    //动画
    [_EnergySharePieChart animateWithXAxisDuration:2.5 easingOption:ChartEasingOptionEaseInOutQuart];
}

-(void)multipleBarChartDataWithFlag:(NSString *)flag{
    //flag(电：01，水：02 气：03 冷： 05)
    NSString *unitStr;
    if ([flag isEqualToString:@"01"]) {
        unitStr=@" kWh";
    }else if ([flag isEqualToString:@"02"]) {
        unitStr=@" m³";
    }else if ([flag isEqualToString:@"03"]) {
        unitStr=@" m³";
    }else if ([flag isEqualToString:@"05"]) {
        unitStr=@" GJ";
    }else{
        unitStr=@"";
    }
    _CompletionRateBarChart.leftAxis.valueFormatter.positiveSuffix = unitStr;//数字后缀单位
    [self setMultipleBarChartData];
}

- (void)onGetGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error{
    if (error == BMK_SEARCH_NO_ERROR) {
        //在此处理正常结果
        _mapView.centerCoordinate=result.location;
        //BMKCoordinateSpan span={0.5, 0.5};
        //_mapView.limitMapRegion = {result.location, span};////限制地图显示范围
        _mapView.rotateEnabled = NO;//禁用旋转手势
    }else {
        NSLog(@"抱歉，未找到结果");
    }
}

-(void)chartValueSelected:(ChartViewBase *)chartView entry:(ChartDataEntry *)entry dataSetIndex:(NSInteger)dataSetIndex highlight:(ChartHighlight *)highlight{
    NSString *text=[CommonTool getStringFromNSArray:_yValsTrueWarnPie key:[[NSString stringWithFormat:@"%ld",(long)highlight.xIndex] intValue]];
    if ([text isEqualToString:@"0"]) {
        [CommonTool showAllTextDialogWithText:@"0%" parentView:_ShareAnalysisWithEnergyPie];
    }else{
        CGFloat allNum=0;
        for (int i=0; i<[_yValsTrueWarnPie count]; i++) {
            CGFloat temValue=[[CommonTool getStringFromNSArray:_yValsTrueWarnPie key:i] floatValue];
            allNum=allNum+temValue;
        }
        CGFloat x=([text floatValue]/allNum)*100;
        NSString *show=[CommonTool keepDecimal:[NSString stringWithFormat:@"%f",x]];
        show=[show stringByAppendingString:@"%"];
        [CommonTool showAllTextDialogWithText:show parentView:_ShareAnalysisWithEnergyPie];
    }
    
}

- (PieChartData *)setPieData{
    //dataSet
    PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithYVals:_yValsWarnPie label:@""];
    dataSet.drawValuesEnabled = NO;//是否绘制显示数据
    dataSet.colors = _pieColors;//区块颜色
    dataSet.sliceSpace = 0;//相邻区块之间的间距
    dataSet.selectionShift = 8;//选中区块时, 放大的半径
    
    dataSet.xValuePosition = PieChartValuePositionInsideSlice;//名称位置
    dataSet.yValuePosition = PieChartValuePositionOutsideSlice;//数据位置
    //数据与区块之间的用于指示的折线样式
    dataSet.valueLinePart1OffsetPercentage = 0.85;//折线中第一段起始位置相对于区块的偏移量, 数值越大, 折线距离区块越远
    dataSet.valueLinePart1Length = 0.5;//折线中第一段长度占比
    dataSet.valueLinePart2Length = 0.4;//折线中第二段长度最大占比
    dataSet.valueLineWidth = 1;//折线的粗细
    dataSet.valueLineColor = [UIColor brownColor];//折线颜色
    //data
    PieChartData *data = [[PieChartData alloc] initWithXVals:_xValsWarnPie dataSet:dataSet];
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterPercentStyle;
    formatter.maximumFractionDigits = 2;//小数位数
    formatter.multiplier = @1.f;
    [data setValueFormatter:formatter];//设置显示数据格式
    [data setValueTextColor:FUIColorFromRGB(0x666666)];
    [data setValueFont:[UIFont systemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:15]]];
    return data;
}

-(void)initBarChartStyleAndData{
    [self setupBarChartView:_CompletionRateBarChart];
    [self setBarChartParam:_CompletionRateBarChart];
    [self setLegendStyle:_CompletionRateBarChart];
}

- (void)setupBarChartView:(BarChartView *)chartView{
    //描述
    chartView.descriptionText = @"";
    //无数据默认显示
    chartView.noDataTextDescription = @"You need to provide data for the chart.";
    //网格背景
    chartView.drawGridBackgroundEnabled = NO;
    chartView.drawBarShadowEnabled = NO;
    chartView.dragEnabled = NO;
    [chartView setScaleEnabled:NO];
    chartView.pinchZoomEnabled = NO;
    //取消Y轴缩放
    chartView.scaleYEnabled = NO;
    //取消双击缩放
    chartView.doubleTapToZoomEnabled = NO;
    chartView.drawValueAboveBarEnabled=YES;
}

-(void)setBarChartParam:(BarChartView *)chartView{
    ChartXAxis *xAxis = chartView.xAxis;
    xAxis.labelPosition = XAxisLabelPositionBottom;
    xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
    
    ChartYAxis *leftAxis = chartView.leftAxis;
    leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
    leftAxis.valueFormatter = [[NSNumberFormatter alloc] init];
    leftAxis.valueFormatter.numberStyle=NSNumberFormatterDecimalStyle;
    leftAxis.valueFormatter.maximumFractionDigits = 1;
    leftAxis.valueFormatter.positiveSuffix = @" kWh";//数字后缀单位
    leftAxis.drawGridLinesEnabled = NO;
    leftAxis.spaceTop = 0.25;
    
    chartView.leftAxis.axisMinValue = 0;//设置Y轴的最小值
    chartView.leftAxis.startAtZeroEnabled = YES;//从0开始绘制
    
    chartView.rightAxis.enabled = NO;
}

//设置图例样式
-(void)setLegendStyle:(BarChartView *)chartView{
    chartView.legend.enabled=NO;
    //图例在柱状图中的位置
    chartView.legend.position = ChartLegendPositionAboveChartCenter;
    //字体大小
    chartView.legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:11.f];
}

- (void)setMultipleBarChartData{
    NSMutableArray *dataSets = [[NSMutableArray alloc] init];
    //实际量数据
    BarChartDataSet *set0=[[BarChartDataSet alloc] initWithYVals:[_yValsRate objectAtIndex:0] label:@"实际完成"];
    [set0 setColor:[_barColors objectAtIndex:0]];
    [dataSets addObject:set0];
    //标准量数据
    BarChartDataSet *set1=[[BarChartDataSet alloc] initWithYVals:[_yValsRate objectAtIndex:1] label:@"定额指标"];
    [set1 setColor:[_barColors objectAtIndex:1]];
    [dataSets addObject:set1];
    
    BarChartData *data = [[BarChartData alloc] initWithXVals:_xValsRate dataSets:dataSets];
    data.groupSpace = 0.8;
    [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]];
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    //自定义数据显示格式
    [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
    [formatter setPositiveFormat:@"#0.00"];
    [data setValueFormatter:formatter];
    _CompletionRateBarChart.data = data;
    //动画
    [_CompletionRateBarChart animateWithYAxisDuration:2.5];
}

-(void)initPieChartStyle:(PieChartView *)chartView{
    //饼状图距离边缘的间隙
    [chartView setExtraOffsetsWithLeft:10 top:0 right:10 bottom:0];
    //是否根据所提供的数据, 将显示数据转换为百分比格式
    chartView.usePercentValuesEnabled = NO;
    //拖拽饼状图后是否有惯性效果
    chartView.dragDecelerationEnabled = YES;
    //是否显示区块文本
    chartView.drawSliceTextEnabled = NO;
    //饼状图是否是空心
    chartView.drawHoleEnabled = NO;
    //空心半径占比
    chartView.holeRadiusPercent = 0.3;
    //空心颜色
    chartView.holeColor = [UIColor clearColor];
    //半透明空心半径占比
    chartView.transparentCircleRadiusPercent = 0.52;
    //半透明空心的颜色
    chartView.transparentCircleColor = [UIColor colorWithRed:210/255.0 green:145/255.0 blue:165/255.0 alpha:0.3];
    if (chartView.isDrawHoleEnabled == YES) {
        chartView.drawCenterTextEnabled = NO;//是否显示中间文字
        //普通文本
        //samplePieChartView.centerText = @"饼状图";//中间文字
        //富文本
        NSMutableAttributedString *centerText = [[NSMutableAttributedString alloc] initWithString:@""];
        [centerText setAttributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:16],
                                    NSForegroundColorAttributeName: [UIColor orangeColor]}
                            range:NSMakeRange(0, centerText.length)];
        chartView.centerAttributedText = centerText;
    }
    chartView.descriptionText = @"";
    chartView.descriptionFont = [UIFont systemFontOfSize:10];
    chartView.descriptionTextColor = [UIColor grayColor];
    //图例在饼状图中的大小占比, 这会影响图例的宽高
    chartView.legend.maxSizePercent = 1;
    //文本间隔
    chartView.legend.formToTextSpace = 5;
    //字体大小
    chartView.legend.font = [UIFont systemFontOfSize:10];
    //字体颜色
    chartView.legend.textColor = [UIColor grayColor];
    //图例在饼状图中的位置
    chartView.legend.position = ChartLegendPositionBelowChartLeft;
    //图示样式: 方形、线条、圆形
    chartView.legend.form = ChartLegendFormCircle;
    //图示大小
    chartView.legend.formSize = 12;
}
@end
